package com.stu.service.permission.impl;

import java.sql.SQLException;
import java.util.HashMap;
import java.util.Map;

import org.hibernate.HibernateException;
import org.springframework.stereotype.Service;

import com.stu.entity.permission.PermissionUser;
import com.stu.service.base.impl.BaseService;
import com.stu.service.permission.IPermissionUserService;

@Service
public class PermissionUserService extends BaseService<PermissionUser> implements IPermissionUserService {

	@Override
	public PermissionUser login(String logincode, String loginpwd) {
		Map<String,Object>params=new HashMap<String,Object>();
		String hql="count(*) from PermissionUser u where u.loginCode=:loginCode and u.loginPwd=:loginPwd ";
		params.put("loginCode", logincode);
		params.put("loginPwd", loginpwd);
		try {
			PermissionUser curUser=baseDao.getByHql(hql, params);
			return curUser;
		} catch (HibernateException e) {
			e.printStackTrace();
			return null;
		} catch (SQLException e) {
			e.printStackTrace();
			return null;
		}
	}

}
